package com.example.testapplication.ui.login;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent;

public class ForgetFragmentViewModel extends BaseViewModel {
    public ForgetFragmentViewModel(@NonNull Application application) {
        super(application);
    }

    //用户名的绑定
    public ObservableField<String> userName = new ObservableField<>("");
    //密码的绑定
    public ObservableField<String> code = new ObservableField<>("");

    //封装一个界面发生改变的观察者
    public UIChangeObservable uc = new UIChangeObservable();

    public class UIChangeObservable {
        //点击事件观察者
        public SingleLiveEvent<Integer> pClickEvent = new SingleLiveEvent<>();
    }

    //titleBar右边的点击事件
    public BindingCommand onTitleBarLeftCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            uc.pClickEvent.setValue(1);

        }
    });

    //倒计时点击事件
    public BindingCommand onCountDownCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            uc.pClickEvent.setValue(2);
        }
    });

    //下一步点击事件
    public BindingCommand onNextCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            uc.pClickEvent.setValue(3);
        }
    });
}
